<template>
  <div class="v-header">
      <div class="content-wrapper">
        <div class="avatar">
            <img :src="seller.avatar" alt="头像" width="64" height="64">
        </div>
        <div class="content">
          <div class="title">
            <div class="brand"></div>
            <span class="name">{{seller.name}}</span>
          </div>
          <div class="description">
            {{seller.description}}/{{seller.deliveryTime}}分钟送达
          </div>
          <div class="support"  v-if="seller.supports">
            <span class="icon" :class="classMap[seller.supports[0].type]"></span>
            <span class="text">{{seller.supports[0].description}}</span>
          </div>
        </div>
        <div v-if="seller.supports" class="suppprot-count" @click="showDetail()">
            <span class="count">{{seller.supports.length}}个 ></span>
            <i ></i>
        </div>
      </div>
      <div class="bulletin-wrapper" @click="showDetail()">
        <span class="bulletin-title"></span><span class="bulletin-text">{{seller.bulletin}}</span>
        <i class="bulletin-more">></i>
      </div>
      <div class="background">
        <img :src="seller.avatar" alt="" width="100%" height="100%">
      </div>  
      <transition name="fade" >
        <div  class="detail" v-show="detailShow" >
            <div class="detail-wrapper clearfix">
              <div class="detail-main">
                <h1 class="name">{{seller.name}}</h1>
                <div class="star-wrapper"><star :starSize="seller.score"></star></div>
                <div class="title">
                  <div class="line"></div>
                  <div class="text">优惠信息</div>
                  <div class="line"></div>
                </div>
                <div v-if="seller.supports" class="supports">
                    <li class="support-item"  v-for=" (i , index) in seller.supports">
                      <span class="icon" :class="classMap[seller.supports[index].type]"></span>
                      <span class="text">{{seller.supports[index].description}}</span>
                    </li>
                </div>
                <div class="title">
                  <div class="line"></div>
                  <div class="text">商家公告</div>
                  <div class="line"></div>
                </div>
                <div class="bulletin">
                  <p class="content">{{seller.bulletin}}{{seller.bulletin}}</p>
                </div>
              </div>
              
            </div>
            <div class="detail-close" @click="closeDetail()">
              X
            </div>
        </div>
      </transition>
  </div>
</template>

<script>
import star from '@/components/star/star.vue'
export default {
  props:{
    seller:{
      type:Object
    },
  },
  data(){
    return{
      detailShow:false
    }
  },
  methods: {
    showDetail(){
      this.detailShow=true
    },
    closeDetail(){
      this.detailShow=false
    }
  },
  components: {
    'star' : star,
  },
  created() {
      this.classMap = ['decrease', 'discount', 'special', 'invoice', 'guarantee'];
  }
}
</script>
<style>
  .v-header{
    color: #Fff;
    position: relative;
    background-color: rgba(7,17,27,.5);
    overflow: hidden;  
  }
  .content-wrapper{
    padding: 24px 12px 18px 24px;
    text-align: left;
    font-size: 0;
    position: relative;
  }
  .content-wrapper .avatar,.content-wrapper  .content{
    font-size: 14px;
    display: inline-block
  }
  .content-wrapper  .content{
    margin-left: 16px;
  }
   .content-wrapper .avatar{
     vertical-align: top;
   }
   .content-wrapper .avatar img{
     border-radius: 2px;
   }
  .content-wrapper .content .title{
    margin: 2px 0 8px 0;
  }
  .content-wrapper .content .title .brand{
    display: inline-block;
    width: 30px;
    height: 18px;
    background-image: url(brand@2x.png);
    background-size: 30px 18px;
    background-repeat: no-repeat;
  }
  @media (-webkit-min-device-pixel-ratio:3),(min-device-pixel-ratio:3){
    .content-wrapper .content .title .brand{
            background-image: url(brand@2x.png);
            background-size: 30px 18px;
            background-repeat: no-repeat;
    }
}

@media (-webkit-min-device-pixel-ratio:2),(min-device-pixel-ratio:2){
    .content-wrapper .content .title .brand{
           
    }
}
  .content-wrapper .content .name{
    margin-left:6px;
    font-size: 16px;
    line-height: 18px;
    font-weight: bold;
    vertical-align: top; 
  }
 .content-wrapper  .description{
   font-size: 12px;
   line-height: 12px;
   margin-bottom: 10px;
 }
 .support .icon{
   display: inline-block;
   width: 12px;
   height: 12px;
   margin-right: 4px;
   background-size: 12px 12px;
   background-repeat: no-repeat;
 }
 .support  .decrease{
    background-image: url(decrease_1@2x.png);
 }
 .support  .discount{
    background-image: url(discount_1@2x.png);
 }
 .support  .guarantee{
    background-image: url(guarantee_1@2x.png);
 }
 .support  .invoice{
    background-image: url(invoice_1@2x.png);
 }
 .support  .special{
    background-image: url(special_1@2x.png);
 }
 .support .text{
  line-height: 12px;
  font-size: 10px;
  vertical-align: top;
 }
 .content-wrapper .suppprot-count{
   position: absolute;
   right: 12px;
   bottom: 18px;
   padding: 0 8px;
   height: 24px;
   line-height: 24px;
   border-radius: 14px;
   background-color:rgba(0,0,0,.2);
   text-align: center;
   font-size: 12px;
 }
 .bulletin-wrapper{
   height: 28px;
   line-height: 28px;
   padding: 0 22px 0 12px;
   overflow: hidden;
   white-space: nowrap;
   text-overflow: ellipsis;
   position: relative;
   background-color: rgba(7,17,27,.2)
 }
 .bulletin-title{
   display: inline-block;
   width: 22px;
   height: 12px;
   background-image: url(bulletin@2x.png);
   background-size: 22px 12px;
   background-repeat: no-repeat;
   vertical-align: top;
   margin-top: 8px;
 }
  .bulletin-text{
    font-size: 12px;
    padding: 0 4px;
    vertical-align: top;
  }
  .bulletin-more{
    position: absolute;
    font-size: 12px;
    right: 12px;
    top: 0px;
    font-style: normal;
  }
  .background{
    position: absolute;
    z-index: -1;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    filter: blur(10px);
  }
  .content-wrapper .detail{
    position: fixed;
    z-index: 100;
    width: 100%;
    height: 100%;
    overflow: auto;
    background: rgba(7,17,27,.8);
    backdrop-filter: blur(10px); 
    top: 0;
    left: 0;
    transition: 0.2s;
  }
  .fade-enter-active{
    opacity: 0;
    transition: 0.2s;
    background: rgba(7,17,27,.8);
  }
  .fade-leave-active{
    opacity: 0;
    transition: 0.2s;
    background: rgba(7,17,27,0);
  }
  .star{
    margin: 0 auto;
  }
  .detail-wrapper{
    min-height: 100%;
    width: 100%;
  }
  .detail-wrapper .detail-main{
    padding-top:64px;
    padding-bottom: 64px; 
  }
  .detail-close{
    position: relative;
    width: 32px;
    height: 32px;
    margin: -64px auto 0 auto;
    clear: both;
    font-size: 24px;
  }
 .detail-main .name{
   line-height: 16px;
   font-size: 16px;
   text-align: center;
   font-weight: 700;
  }
  .star-wrapper{
    margin-top:16px;
    margin-bottom: 28px;
  }
  .detail-main .title{
    display: flex;
    width: 80%;
    margin: 28px auto 24px auto;
  }
  .detail-main .title .line{
    flex: 1;
    position: relative;
    top: -6px;
    border-bottom: 1px solid rgba(255,255,255,.2)
  }
  .detail-main .title .text{
    padding: 0 12px;
    font-size: 14px;
    font-weight: 700;
  }
  .support-item .icon{
   display: inline-block;
   width: 18px;
   height: 18px;
   margin-right: 4px;
   vertical-align: top;
   background-size: 18px 18px;
   background-repeat: no-repeat;
 }
  .support-item {
    padding: 0 12px;
    margin-bottom: 12px;
    font-size: 12px;
    display: inline-block;
    width: 100%;
    text-align: left;
  }
  .support-item :last-child{
    margin-bottom: 0;
  }
 .support-item  .decrease{
    background-image: url(decrease_1@3x.png);
 }
 .support-item  .discount{
    background-image: url(discount_1@3x.png);
 }
 .support-item  .guarantee{
    background-image: url(guarantee_1@3x.png);
 }
 .support-item  .invoice{
    background-image: url(invoice_1@3x.png);
 }
 .support-item  .special{
    background-image: url(special_1@3x.png);
 }
 .support-item .text{
  line-height: 18px;
  font-size: 10px;
  vertical-align: top;
 }
 .supports{
   width: 80%;
   margin: 0 auto;
 }
 .bulletin{
   width: 80%;
   margin: 0 auto;
 }
 .bulletin .content{
   padding: 0 12;
   line-height: 24px;
   font-size: 12px;
   text-align: left;
 }


</style>
